import { useState } from "react";
import { useNavigate } from "react-router-dom";
import "./index.less";

export default function TabList({ data = [], type, typeName }: any) {
  const navigate = useNavigate();

  const detailClick = (id: any) => {
    navigate(`/infoDetail?type=${type}&id=${id}`);
  };

  return (
    <div className="ci_list_contarnier">
      <div className="ci_lc_content">
        {data?.length > 0 &&
          data?.map((item: any, index: number) => {
            return (
              <div
                className="ci_lc_meta"
                key={`ci_lc_meta_${index}`}
                onClick={() => detailClick(item.id)}
              >
                <div className="ci_lc_title">
                  <div className="ci_lc_title_tit">{item.title || ""}</div>
                  <div className="ci_lc_title_type">
                    <div>{item.sendType || ""}</div>
                    <div>{item.sentTime}</div>
                  </div>
                </div>
                <div className="ci_lc_imgbox">
                  <img src={item.img || ""} alt="" />
                </div>
              </div>
            );
          })}
      </div>
    </div>
  );
}
